<!DOCTYPE html>
<html lang="en">
<head th:include="certificateWeb/headFoot :: headerCss">
</head>
<!--<link href="/css/web/themes/about.css" rel="stylesheet">-->
<link rel="stylesheet" href="/css/certificateWeb/workNews/workNews.css">
<body id="body">
<div th:include="certificateWeb/headFoot :: header"></div>
<main id="main" style="background: #fff">
    <section class="sec_2">
        <!--<div class="form-control div_1">-->
            <!--<ul>-->
                <!--<li><a href="/certificate/infoEnter">信息录入</a></li>-->
                <!--<li><a href="/certificate/onLinePay">在线缴费</a></li>-->
            <!--</ul>-->
        <!--</div>-->
        <div class="form-control" style="margin:100px 0">
            <label style=" font-size: 18px; margin-right: 25px; font-weight: bold">选择认证批次</label>
            <hr/>
            <input type="hidden" id="uName" th:value="${uName}" />
            <div id="news"></div>
            <div id="page"></div>
        </div>

        <div style="clear: both"></div>
    </section>
</main>
<div th:include="certificateWeb/headFoot :: footer"></div>
<script>
    $(function () {
        $.ajax({
            url: "/certificate/selectBatchList",
            type: 'GET',
            data: {
                current: 1,
                number:10
            },
            success: function (res) {
                if(res.data.pages==0){
                    $("#news").html('<div class="noData">暂无数据</div>');
                }else{
                    var list = res.data.records;
                    var news = '';
                    list.forEach(function (item, index) {
                        news += '<a href="/certificate/introduce?batchId=' + item.id + '" class="flex hov">' +
                            '<span class="span_2">' + item.name+'</span><span class="span_2">报名截止时间：'+ item.endTime+'</span>' +
                            '<span class="span_1" style="text-align: right;color: #333">点击进入</span></a>';
                    });
                    $("#news").html(news);
                    page(1,res.data.pages);
                }
            }
        });
    });
    function page(num,tolPages) {
        $("#page").paging({
            nowPage:Number(num), // 当前页码
            pageNum:Number(tolPages), // 总页码
            buttonNum:10, //要展示的页码数量
            canJump: 1,// 是否能跳转。0=不显示（默认），1=显示
            showOne: 0,//只有一页时，是否显示。0=不显示,1=显示（默认）
            callback: function (num) { //回调函数
                $.ajax({
                    url: "/certificate/selectBatchList",
                    type: 'GET',
                    data: {
                        current: num,
                        number: 10
                    },
                    success:function (res) {
                        console.log(res);
                        var list = res.data.records;
                        var news = '';
                        list.forEach(function (item, index) {
                            news += '<a href="/certificate/introduce?batchId=' + item.id + '" target="_blank" class="flex">' +
                                '<span class="span_2">' + item.name+'</span>报名截止时间：'+ item.endTime+'</a>';
                        });
                        $("#news").html(news)
                    }
                });
            }
        });
    }
</script>
<script type="text/javascript" src="/js/xlPaging.js"></script>
</body>
</html>